<template>
  <div>
    <div class="user_info_wrap">
      <div
        style="
          display: flex;
          width: calc(100% - 40px);
          margin-left: 20px;
          box-shadow: 0px 2px 8px 0px rgba(150, 150, 150, 0.2);
        "
      >
      
        <div class="user_info"   style="margin-left: 30px;">
          <div class="user_name">
             <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getDetail"></right-toolbar> -->
            <div>
              <span>{{scheduleInfo.courseNumber}}</span>
            </div>
          </div>
          <div class="usr_detail_info">
            <div>
              <span>课程开始时间：{{ parseTime(scheduleInfo.startTime, '{y}-{m}-{d} {h}:{m}') }}</span>
            </div>
            <div>
              <span>课程结束时间：{{ parseTime(scheduleInfo.endTime, '{y}-{m}-{d} {h}:{m}') }}</span>
            </div>
            <div>课程教师：{{scheduleInfo.teacherNumber}}</div>
            <div>学生总数：{{scheduleInfo.totalStudentNum}} 人 </div>
            <div>课堂销课：{{scheduleInfo.marketingStudentNum}} 人 </div>
            <div>课堂评价：{{scheduleInfo.evaluationStudentNum}} 人 </div>
          </div>
        </div>
      </div>
    </div>
    <div class="records">
      <div class="nav_wrap">
        <template>
          <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="课堂学生" name="student">
              <Student-list ref="StudentList" />
            </el-tab-pane>
          </el-tabs>
        </template>
      </div>
    </div>
  </div>
</template>

<script>

import {
  getStudent,queryDetailsSchedule
} from "@/api/school/schedule";
import StudentList from './model/StudentList.vue'

export default {
  name: "detail",
  components: {StudentList},
  data() {
    return {
      activeName: 'student',
      scheduleInfo: {}
    };
  },
  created() {
    this.getDetail();//查询课程详情
  },
  mounted() {
    this.$refs.StudentList.getData();//查询课程学生列表
  },
  methods: {
    handleClick(tab) {
      this.activeName = tab.name
      if (this.activeName == 'student') {
        this.$refs.StudentList.getData()
      } 
    },
    getDetail() {
      queryDetailsSchedule({id: this.$route.query.id,
      classId:this.$route.query.courseNumber,
      courseStartime:this.$route.query.startTime,
      counrseEndtime:this.$route.query.endTime}).then(res => {
        this.scheduleInfo = res.rows[0];
      })
    }
  },
};
</script>
<style scoped lang="scss">
@font-face {
  font-family: "iconfont"; /* Project id 1243753 */
  src: url("//at.alicdn.com/t/font_1243753_y4iv3dvk22.woff2?t=1639976952370")
      format("woff2"),
    url("//at.alicdn.com/t/font_1243753_y4iv3dvk22.woff?t=1639976952370")
      format("woff"),
    url("//at.alicdn.com/t/font_1243753_y4iv3dvk22.ttf?t=1639976952370")
      format("truetype");
}
.iconfont {
  font-family: "iconfont" !important;
  font-size: 16px;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.user_info_wrap {
  display: flex;
  padding: 20px 0px;
  box-sizing: border-box;
  .avatar_wrap {
    width: 120px;
    display: flex;
    justify-content: center;
    .avatar {
      width: 75px;
      height: 75px;
      border-radius: 50%;
      overflow: hidden;
    }
  }
  .user_info {
    flex: 1;
    .user_name {
      height: 75px;
      display: flex;
      margin-bottom: 15px;
      flex-direction: column;
      justify-content: space-evenly;
      .sex_nan {
        font-size: 12px;
        color: rgb(64, 158, 255);
      }
      .sex_nv {
        font-size: 12px;
        color: #FF69B4;
      }
      .study_status {
        .tag {
          display: inline-block;
          border-radius: 4px;
          padding: 2px 8px;
          color: rgb(64, 158, 255);
          font-size: 10px;
          border: 1px solid rgb(64, 158, 255);
        }
      }
    }
    .usr_detail_info {
      display: flex;
      flex-wrap: wrap;
      font-size: 14px;
      color: #737373;
      div {
        width: 31%;
        margin-bottom: 20px;
        margin-right: 30px;
      }
      div:nth-child(3n + 3) {
        margin-right: 0px;
      }
    }
  }
}
.records {
  width: calc(100% - 40px);
  padding: 10px 10px 0px;
  box-sizing: border-box;
  margin-bottom: 20px;
  margin-left: 20px;
  box-shadow: 0px 2px 8px 0px rgba(150, 150, 150, 0.2);
  .nav_wrap {
    margin: 0px 10px;
  }
}
</style>